<html>
<head><meta charset="utf-8"><title>How to trigger inlining pass? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html">How to trigger inlining pass?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208813429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813429">(Sep 02 2020 at 12:07)</a>:</h4>
<p>bulit rustc with 'x.py test --stage 1', then compile a file with #[inline] function, but <code>RUSTC_LOG=rustc_mir::transform::inline=debug</code> didn't print any log inside compiler/librustc_mir/transform/inline.rs</p>



<a name="208813461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813461">(Sep 02 2020 at 12:07)</a>:</h4>
<p>Inlining only runs with <code>-Zmir-opt-level=2</code> I believe</p>



<a name="208813468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813468">(Sep 02 2020 at 12:07)</a>:</h4>
<p>or 3</p>



<a name="208813515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813515">(Sep 02 2020 at 12:08)</a>:</h4>
<p>I believe it is 2.</p>



<a name="208813559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813559">(Sep 02 2020 at 12:08)</a>:</h4>
<p>thanks^_^</p>



<a name="208813568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208813568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208813568">(Sep 02 2020 at 12:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/da897dfb6daa268a965d2d73620316ba56020a19/compiler/rustc_mir/src/transform/inline.rs#L41">https://github.com/rust-lang/rust/blob/da897dfb6daa268a965d2d73620316ba56020a19/compiler/rustc_mir/src/transform/inline.rs#L41</a></p>
<p>It is from 2.</p>



<a name="208816289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208816289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208816289">(Sep 02 2020 at 12:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20trigger.20inlining.20pass.3F/near/208813568">said</a>:</p>
<blockquote>
<p><a href="https://github.com/rust-lang/rust/blob/da897dfb6daa268a965d2d73620316ba56020a19/compiler/rustc_mir/src/transform/inline.rs#L41">https://github.com/rust-lang/rust/blob/da897dfb6daa268a965d2d73620316ba56020a19/compiler/rustc_mir/src/transform/inline.rs#L41</a></p>
<p>It is from 2.</p>
</blockquote>
<p>so does it mean <code>#[inline(...)]</code> on function with stable rustc is meaningless?</p>



<a name="208816631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208816631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208816631">(Sep 02 2020 at 12:36)</a>:</h4>
<p>Inlining is performed by LLVM.</p>



<a name="208816711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20trigger%20inlining%20pass%3F/near/208816711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20trigger.20inlining.20pass.3F.html#208816711">(Sep 02 2020 at 12:37)</a>:</h4>
<p>MIR inlining has the theoretical benefit over LLVM inlining that it is performed before monomorphization, which prevents duplicate work for each monomorphization of a function.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>